home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "DAO Speed Test VB"
- ClientHeight = 3030
- ClientLeft = 1770
- ClientTop = 3075
- ClientWidth = 6825
- Height = 3435
- Left = 1710
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3030
- ScaleWidth = 6825
- Top = 2730
- Width = 6945
- Begin VB.TextBox txtNumRecs
- Alignment = 1 'Right Justify
- Height = 495
- Left = 3960
- MaxLength = 6
- TabIndex = 3
- Text = "0"
- Top = 2280
- Width = 1575
- End
- Begin VB.CommandButton btnStart
- Caption = "Start"
- Height = 375
- Left = 120
- TabIndex = 1
- Top = 840
- Width = 1095
- End
- Begin VB.ListBox lstTimeResults
- Height = 2010
- ItemData = "Form1.frx":0000
- Left = 1320
- List = "Form1.frx":0002
- TabIndex = 0
- Top = 120
- Width = 5415
- End
- Begin VB.Label Label1
- Caption = "Enter The Number Of Records To Use In This Test:"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 2400
- Width = 3735
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub btnStart_Click()
- If Val(txtNumRecs) < 1000 Then
- txtNumRecs.Text = "1000"
- End If
- If Val(txtNumRecs) > 100000 Then
- txtNumRecs.Text = "100000"
- End If
- btnStart.Enabled = False
- 'set up variables
- Dim MyWs As Workspace
- Dim MyDb As Database
- Dim MyRs As Recordset
- Dim Tbl1 As TableDef
- Dim Fld1 As Field
- Dim Fld2 As Field
- Dim sT1, eT1 As Long
- Dim s, e As Long
- ' start time t1
- sT1 = Timer
- Set MyWs = DBEngine.Workspaces(0)
- 'create database
- ' start time t2
- s = Timer
- Set MyDb = MyWs.CreateDatabase("SpeedVB.mdb", dbLangGeneral, dbVersion30)
- Set Tbl1 = MyDb.CreateTableDef("Table1")
- Set Fld1 = Tbl1.CreateField("IntField", dbLong)
- Fld1.Attributes = dbAutoIncrField
- Set Fld2 = Tbl1.CreateField("TextField", dbText)
- Fld2.Size = 30
- Tbl1.Fields.Append Fld1
- Tbl1.Fields.Append Fld2
- MyDb.TableDefs.Append Tbl1
- e = Timer
- ' end time t2
- lstTimeResults.AddItem "Created SpeedVB.MDB - " + Str(e - s)
- 'fill data
- ' start time t3
- s = Timer
- Set MyRs = MyDb.OpenRecordset("Table1", dbOpenTable, 0)
- For i = 1 To Val(txtNumRecs)
- MyRs.AddNew
- MyRs![TextField] = "Entry #" + Str(i)
- MyRs.Update
- Next i
- MyRs.Close
- e = Timer
- ' end time t3
- lstTimeResults.AddItem "Filled SpeedVB.MDB With Data - " + Str(e - s)
- 'forward naviagation of data
- ' start time t4
- s = Timer
- Set MyRs = MyDb.OpenRecordset("Table1", dbOpenTable, 0)
- Do Until MyRs.EOF
- MyRs.MoveNext
- Loop
- MyRs.Close
- e = Timer
- ' end time t4
- lstTimeResults.AddItem "Navigated Forward Through SpeedVB.MDB - " + Str(e - s)
- 'backward naviagation of data
- ' start time t5
- s = Timer
- Set MyRs = MyDb.OpenRecordset("Table1", dbOpenTable, 0)
- MyRs.MoveLast
- MyRs.MovePrevious
- Loop While Not MyRs.BOF
- MyRs.Close
- e = Timer
- ' end time t5
- lstTimeResults.AddItem "Navigated Backward Through SpeedVB.MDB - " + Str(e - s)
- btnStart.Enabled = True
- eT1 = Timer
- 'end time t1
- lstTimeResults.AddItem "Total Time: " + Str(eT1 - sT1)
- End Sub
-